import getDataForDB from '@/api/qsbBusinessManagement'
import getDataForDB1 from '@/api/qsbserviceEnterprise'
import {getEntMoneyInfo} from '@/api/invoiceAdminister'
import * as Util from '@/utils/util'

/**
 * 删除企业信息
 * @param {*} pageSelf
 * @param {*} entId
 */
const delEntInfo = async (pageSelf,entId)=>{
  console.log('删除企业信息====>',entId);
  const { result, success,message } = await getDataForDB('根据企业id删除企业信息', {entId})
  if(success==true){
    pageSelf.endServiceConfig1.title = '数据删除成功'
    pageSelf.endServiceConfig1.isDelete = false
  }else{
    pageSelf.$message.warning(message)
  }
}

/**
 * 判断企业法人的三要素是否通过  默认 false 不通过
 * @param {*} entId
 */
const getLegalInfo = async (pageSelf,entId)=>{
  let res = false
  let data_ = []
  const { result, success } = await getDataForDB('查询企业法人信息', {entId})
  if(success){
    if(result.length>0){
      if(result[0].verification == 1){
        // 通过核验
        res = true
      }
      data_= result
    }
  }
  return {res,data:data_}
}

/**
 * 查询企业数电发票额度
 * @param {*} pageSelf
 * @param {*} param
 */
const queryEntInvcAmount = async (pageSelf, param)=>{
  const { result, code,message } = await getDataForDB('查询企业数电发票额度',param)
  console.log('查询企业数电发票额度',result);
  if(code==200){
    const {maxSdAmount, nowUseAmount} = result
    pageSelf.sdfpConfig.data = [
      {type:'数电发票',kpxe:maxSdAmount,zyje:nowUseAmount,syje:maxSdAmount-nowUseAmount,}
    ]
  }else{
    pageSelf.$message.warning(message)
  }
}
/**
 * 设置企业数电限额
 * @param {*} pageSelf
 * @param {*} param  {entId,maxSdAmount}
 */
const setEntInvcAmount = async (pageSelf, param)=>{
  const { result, code,message } = await getDataForDB('设置企业数电限额',param)
  if(code==200){
    pageSelf.$message.success(message|| '数据保存成功')
  }else{
    pageSelf.$message.warning(message)
  }
}


/**
 * 查询企业合同服务模式配置
 * @param {*} pageSelf
 * @param {*} entId
 */
const getQueryEntSvConf = async (pageSelf, entId) =>{
  const convData= (val)=>{
    let res = 0
    if(!pageSelf.isType.isEmpty(val) && pageSelf.isType.isNumber(val)){
      res = `${Util.conversionElement(val)} 元`
    } else {
      res = '-'
    }
    return res
  }

  const getModelDataInfo = (rateType,servicerateList)=>{
    const avtionList={
      1:()=>{
        const {rate} = servicerateList[0] || {rate:0}
       return `${Util.percentConversion(rate)}%`
      },
      2:()=>{
        const tempArr=[]
        servicerateList.forEach(item=>{
          const {max,min,rate} = item
          tempArr.push(`${convData(min)}<=${convData(max)};${Util.percentConversion(rate)}%`)
        })
        return tempArr.join('\r\n')
      },
      3:()=>{
        const tempArr=[]
        servicerateList.forEach(item=>{
          const {max,min,rate} = item
          tempArr.push(`${convData(min)}<=${convData(max)};${Util.percentConversion(rate)}%`)
        })
        return tempArr.join('\r\n')
      }
    }
    return avtionList[rateType] && avtionList[rateType]() || '-'
  }

  const modelData={
    1:'固定费率',2:'阶梯费率',3:'累计阶梯'
  }

  const param={
    entId
  }
  const { result, code, message } = await getDataForDB('查询企业合同服务模式配置', param)
  if(code==200){
    const { servicefeeList, servicerateList, svModelDesc, svModelName, rateType, invoiceMax ,invoiceMin} = result
    pageSelf.formList.qyfysmFrom[0].value = convData(servicefeeList[0].svRegistPrice) // 注册服务费
    pageSelf.formList.qyfysmFrom[1].value = convData(servicefeeList[0].svBankPrice) // 开户服务费
    pageSelf.formList.qyfysmFrom[2].value = convData(servicefeeList[0].svTaxPrice) // 税务变更费
    pageSelf.formList.qyfysmFrom[3].value = convData(servicefeeList[0].svYearPrice) // 服务年费
    pageSelf.formList.qyfysmFrom[4].value = convData(servicefeeList[0].svBusinessPrice) // 工商变更费
    pageSelf.formList.qyfysmFrom[5].value = servicefeeList[0].svCanclePrice > 0 ? convData(servicefeeList[0].svCanclePrice) + '起' : '0元' // 企业注销费
    pageSelf.formList.qyfysmFrom[6].value = `${convData(invoiceMin)} <= ${convData(invoiceMax)}` // 月开票额度限制
    pageSelf.formList.qyfysmFrom[7].value = modelData[rateType] // 服务费模式
    pageSelf.formList.qyfysmFrom[8].value = getModelDataInfo(rateType,servicerateList) // 服务费率
    pageSelf.formList.qyfysmFrom[9].value = svModelName // 企业服务模式
    pageSelf.formList.qyfysmFrom[10].value = svModelDesc// 企业服务模式说明



  }else{
    pageSelf.$message.warning(message)
  }
}


/**
 * 查询企业列表数据
 * @param {*} pageSelf
 */
const getDataForTableList = async (pageSelf) => {
  pageSelf.loading = true
  window['enterpriseList_param'] = pageSelf.queryParam
  const { result, code } = await getDataForDB('企业列表查询', pageSelf.queryParam)
  // console.log('企业列表查询 getDataForTableList ===>', result);
  if (code === 200) {
    const { current, pages, records, size, total } = result
    pageSelf.ipagination.pageSize = size
    pageSelf.ipagination.current = current
    pageSelf.ipagination.total = total
    pageSelf.tableData = records

  }
  pageSelf.loading = false
}

/**
 * 查询 发票类型
 * @param {*} pageSelf
 */
const getDataForfpglTableList = async (pageSelf, entId) => {
  pageSelf.loading = true
  const { result, code } = await getDataForDB('获取企业发票号段详细余量 - 聚合接口', { entId, invcId:'' })
  console.log('获取企业发票号段详细余量 - 聚合接口 getDataForfpglTableList ===>', result);
  if (code === 200) {
    // {taxType:'普通',taxMedium:'纸质',syyl:'上月余量',byly:'本月领用',bysy:'本月使用',dyyl:'当月余量'}
    // 普通  纸质
    pageSelf.fpglDataSource[0].syyl = result.pzOld
    pageSelf.fpglDataSource[0].byly = result.pzNow
    pageSelf.fpglDataSource[0].bysy = Number(result.pzNowUse) + Number(result.pzOldUse) // 本月使用
    pageSelf.fpglDataSource[0].dyyl = result.pz
    pageSelf.fpglDataSource[0].ydhdsl = result.pzCanGet
    // 专用  纸质
    pageSelf.fpglDataSource[1].syyl = result.zzOld
    pageSelf.fpglDataSource[1].byly = result.zzNow
    pageSelf.fpglDataSource[1].bysy = Number(result.zzNowUse) + Number(result.zzOldUse) // 本月使用
    pageSelf.fpglDataSource[1].dyyl = result.zz
    pageSelf.fpglDataSource[1].ydhdsl = result.zzCanGet
    // 普通  电子
    pageSelf.fpglDataSource[2].syyl = result.pdOld
    pageSelf.fpglDataSource[2].byly = result.pdNow
    pageSelf.fpglDataSource[2].bysy = Number(result.pdNowUse) + Number(result.pdOldUse)// 本月使用
    pageSelf.fpglDataSource[2].dyyl = result.pd
    pageSelf.fpglDataSource[2].ydhdsl = result.pdCanGet
    // 专用  电子
    pageSelf.fpglDataSource[3].syyl = result.zdOld
    pageSelf.fpglDataSource[3].byly = result.zdNow
    pageSelf.fpglDataSource[3].bysy = Number(result.zdNowUse) + Number(result.zdOldUse) // 本月使用
    pageSelf.fpglDataSource[3].dyyl = result.zd
    pageSelf.fpglDataSource[3].ydhdsl = result.zdCanGet


  }
  pageSelf.loading = false
}

/**
 * 获取 进行中的服务 的数据
 * @param {*} pageSelf
 */
const ServicesInProgressData = async (pageSelf, entId) => {
  pageSelf.tableConfig.loading = true
  let res = []
  try {
    const { result, code } = await getDataForDB('进行中的服务', { entId })
    if (code == 200) {
      res = result
    }
  } catch (error) {
    console.log('进行中的服务 接口报错，原因如下：', error);
  }
  if (res.length > 0) {
    pageSelf.tableConfig.tableData = res
  }
  pageSelf.tableConfig.loading = false
  return res
}


const getDataForServicesInProgress = async () => {
  try {
    const param = {
      "data": {
        "businessStatus": 0,
        "businessType": 1001,
        "channelName": "",
        "createTimeEnd": "",
        "createTimeStart": "",
        "entName": "",
        "entType": 1,
        "payerType": 0
      },
      "pageNo": 1,
      "pageSize": 10
    }
    const { code, result } = await getDataForDB1('订单列表', param)
    if (code == 200) {
      res = result
    }
  } catch (error) {
    console.log('订单列表 接口报错，具体原因如下：', error);
  }
}
// const tempimgGroupData = [
//     'http://zxcloud-test.oss-cn-hangzhou.aliyuncs.com/qsb/idCard/1667219411398_%E8%BA%AB%E4%BB%BD%E8%AF%81%E6%AD%A3%E9%9D%A2(1).jpg',
//     // {url:'http://zxcloud-test.oss-cn-hangzhou.aliyuncs.com/qsb/idCard/1667219411398_%E8%BA%AB%E4%BB%BD%E8%AF%81%E6%AD%A3%E9%9D%A2(1).jpg', title:'说明：营业执照'},
//     // {url:'http://zxcloud-test.oss-cn-hangzhou.aliyuncs.com/qsb/idCard/1667219411398_%E8%BA%AB%E4%BB%BD%E8%AF%81%E6%AD%A3%E9%9D%A2(1).jpg', title:'说明：身份证'},
//     // {url:'http://zxcloud-test.oss-cn-hangzhou.aliyuncs.com/qsb/idCard/1667219411398_%E8%BA%AB%E4%BB%BD%E8%AF%81%E6%AD%A3%E9%9D%A2(1).jpg', title:''},
// ]

// const tempTextGroupData = [
//     { type: 'text', label: '待定', border: true, isEvent: false },
//     { type: 'link', label: '查看核定通知书', isEvent: true },
// ]

// const tempObj_ = {"entDetailBase":{"cardNumber":"cardNumber","entName":"entName","legalName":"张三","licenseUrl":tempimgGroupData,"lisenceAddress":"lisenceAddress","lisenceCreditCode":"lisenceCreditCode","lisenceIncorpDate":"lisenceIncorpDate","lisenceMgrNature":"lisenceMgrNature"},"entDetailLegal":{"bizUserName":"张三","entId":1001,"invoiceMax":470000000,"invoiceMaxDesc":"最高470万元","legalName":"张三","legalPhone":"111111111111","registerType":1,"serviceEnd":"2023-07-01","serviceStart":"2022-07-01","taxMode":tempTextGroupData,"taxStatus":0},"entDetailProgress":{"collectProgress":[{"setNodeName":"负责人信息","setNodeStatus":0,"setNodeType":1}],"registProgress":[{"setNodeName":"负责人信息","setNodeStatus":0,"setNodeType":1}],"taxProgress":[{"setNodeName":"负责人信息","setNodeStatus":0,"setNodeType":1}]},"orderInfo":{"businessStatus":30,"businessStatusName":"待支付","businessTime":"2022-11-01 12:11:12","businessType":1001,"channelId":1001,"channelName":"哇哈哈","createBy":"","createById":0,"createTime":"createTime","delFlag":0,"entId":"哇哈哈","entName":"哇哈哈","id":0,"isInvoicing":1,"paymentStatus":1,"paymentTime":"2022-11-01 12:11:12","updateBy":"","updateById":0,"updateTime":""}}

/**
 * 根据code换取 对应的 核定税种
 * @param {*} taxMode
 * @param {*} pageSelf
 * @returns
 */
const getTaxMode = (taxMode, pageSelf) => {
  return pageSelf.tempDetailConfig.hdsz[taxMode]
}

const getSetStatus = (setStatus, pageSelf) => {
  return pageSelf.tempDetailConfig.qyslzt[setStatus]
}

/**
 * 根据id 获取企业详情
 * @param {*} pageSelf
 * @param {*} id
 */
const getDataForEnterpriseDetails = async (pageSelf, id, type) => {
  const { result, success,message } = await getDataForDB('企业详情查询', { entId: id })
  if (success) {
    const result_ = result // tempObj_
    // console.log('getDataForEnterpriseDetails===>',result,code);
    // console.log('getDataForEnterpriseDetails===>', pageSelf, result_, result, pageSelf.formList.defaultForm[6]);
    // 当 当前企业的状态为 已设立（140） 时，需要跳转到已设立的详情页面
    if(result_.entDetailBase.status == '140'){
      pageSelf.$router.push({
        // path: tempUrlList[tempActionList[status_]],
        path: '/enterprise/enterpriseList/enterpriseDetails1',
        query: {
          bizId: result.entDetailLegal.entId,
        },
      })
    }
    // 是否要显示欢迎页面
    if(result.entDetailBase.doneDis===0 && pageSelf.winConfig){
      // 显示欢迎页面  入驻成功展示标记
      getDataForDB('入驻成功展示标记', { entId: id })
      pageSelf.winConfig.width = 1000
      pageSelf.winConfig.componentName = 'completed'
      pageSelf.winConfig.visible = true
    }
    if(type==1){
      // 开票类型 1-传统票 2-数电票 3-混合票
      pageSelf.sdfpConfig.ticketType = result_.entDetailBase.ticketType
    }
    // const tempDetail = JSON.parse(sessionStorage.getItem('qsb-details'))
    // console.log('当前选择的数据====tempDetail=======》',tempDetail,result.entDetailBase.doneDis );
    pageSelf.entDetailProgress = {...result_.entDetailProgress,cardNumber:result_.entDetailBase.cardNumber,legalName:result_.entDetailBase.legalName}
    // 是否存在进行中续费订单 0-否 1-是    续费主订单号    续费子订单号
    // renewFlag  renewOrderNo  renewSubOrderNo
    if (type == 1) {
      if (result.renewFlag === 0) {
        // 不存在进行中的
        // pageSelf.formList.defaultForm[8].value[1].label = '服务续费'// 20241202 按业务要求 去掉 勤税宝 企业端 企业管理 我的企业 列表详情中 在企业已设立状态下  服务期限 中的 服务续费 功能
      } else {
        // 存在进行中的订单
        // pageSelf.formList.defaultForm[8].value[1].label = '去支付' // 20241202 按业务要求 去掉 勤税宝 企业端 企业管理 我的企业 列表详情中 在企业已设立状态下  服务期限 中的 服务续费 功能
        pageSelf.orderListInfo = { orderList: [result.renewOrderNo, result.renewSubOrderNo] }
      }

      // 是否允许开票 0-否 1-是       禁止开票原因 1-税务变更中 2-服务模式变更中 3-个税申报中
      //  invoiceFlag  invoiceReason
      let temphasDJGS = true
      if (result.invoiceFlag === 0) {
        // 不允许开票   个税申报中
        temphasDJGS = true
        pageSelf.btnGroupConfig.btnList[0].label = { 1: '税务变更中', 2: '服务模式变更中', 3: '个税申报中', 4: '企业未设立' }[result.invoiceReason]
      } else {
        temphasDJGS = false
      }
      pageSelf.btnGroupConfig.btnListNew[1].hasDJGS = temphasDJGS
      pageSelf.btnGroupConfig.btnList[0].hasDJGS = !temphasDJGS
    }
    if (type == 0) {
      pageSelf.registOrderNo = result_.registOrderNo
    }
    // console.log('##############################', result_, pageSelf.registOrderNo);
    const taxMode =result_.entDetailLegal && result_.entDetailLegal.taxMode || 0
    pageSelf.taxMode = taxMode
    pageSelf.qsbDetails = {
      checkInfo:result_.checkInfo,
      setStatus: getSetStatus(result_.setStatus, pageSelf),
      ...result_.entDetailBase, ...result_.entDetailLegal,
      taxMode: [getTaxMode(taxMode, pageSelf) || ''],
      ...result_.orderInfo,
      ...result_.entAgreeResp,
      protocolType:result_.entDetailBase.protocolType, // 合作模式

      businessAccountResp:result_.businessAccountResp,
      entHirePic:result_.entHirePic,
      entTaxPic:result_.entTaxPic,
    }
    console.log('详情数据=====》',result_,result_.entDetailBase.protocolType);
    setDataForPageFormData(pageSelf)
     // 添加 年度开票额度 显示限制
    if(taxMode==0){
      pageSelf.formList.defaultForm[0].value = '--'
    }
  }else{
    pageSelf.$message.warning(message||'企业详情查询失败')
  }
}

const getTaxModeType = async (pageSelf, id)=>{
  // const res = await getEntMoneyInfo(id)
  // console.log('@@@@@@@@@@@@@@',res); // quarterMoneyLimit
  // Util.conversionManyElement()
  // if(res.code==200){
  //   pageSelf.formList.defaultForm[0].value =  Util.conversionManyElement(res.result.quarterMoneyLimit|| 0)+' 万元'
  //   pageSelf.formList.defaultForm[0].cnName = '月开票额度'
  // }else{
  //   console.log('接口出错了',res);
  // }
  pageSelf.formList.defaultForm[0].value =  '增值税、个人所得税双免政策额度内'
  pageSelf.formList.defaultForm[0].cnName = '月开票额度'
}

const setDataForPageFormData = (pageSelf) => {
  const tempObj = pageSelf.formList
  const setValue = (data, value) => {
    let res = ''
    if (Object.prototype.toString.call(value) === '[object Array]') {
      if (Object.prototype.toString.call(data) === '[object Array]') {
        res = data
      }
      if (Object.prototype.toString.call(data) === '[object String]') {
        res = [data]
      }
      if (Object.prototype.toString.call(data) === '[object Null]') {
        res = []
      }

    }
    if (Object.prototype.toString.call(value) === '[object String]'|| Object.prototype.toString.call(value) === '[object Number]') {
      res = data
    }
    return res
  }
  const getTypeData = (key, val_) => {
    const keyList = {
      registerType: (val) => {
        let res = ''
        const tempList = pageSelf.tempDetailConfig.qyType
        tempList.forEach(item => {
          const { enName, cnName } = item
          if (val == enName) {
            res = cnName
          }
        })
        return res
      }
    }
    return keyList[key] ? keyList[key](val_) : val_
  }

  const setDateStr = (key, val) => {
    if (key == 'serviceStart' || key == 'serviceEnd') {
      return val && val.split(' ')[0] || ''
    }
    return val
  }

  const setData = (dataList) => {
    dataList.forEach(item => {
      const { enName, type, value } = item
      let value_ = ''
      if (enName.indexOf('|') >= 0) {
        const tempArr = enName.split('|')
        const tArr = []
        tempArr.forEach(key => {
          tArr.push(setDateStr(key, pageSelf.qsbDetails[key]))
        })
        let tempVal_ = tArr.join('~')
        if (type === 'textGroup') {
          const tempObj_ = JSON.parse(JSON.stringify(value[0]))
          tempObj_.label = tempVal_
          value_ = [tempObj_, value[1]]
        } else {
          value_ = setValue(tArr.join('~'), value)
        }
        // console.log(value_, enName, type, value);
      } else {
        if (type === 'textGroup') {

          // if (value.length > 1) {
          //   value_ = [...pageSelf.qsbDetails[enName], value[1]]
          // }
          // if (value.length == 1) {
          //   value_ = [...pageSelf.qsbDetails[enName], value[0]]
          // }
          // if (value.length == 0) {
          //   value_ = [...pageSelf.qsbDetails[enName]]
          // }
          // if(JSON.stringify(pageSelf.qsbDetails[enName]) == JSON.stringify(value[1])){
          //   value_ = [...pageSelf.qsbDetails[enName]]
          // }
          value_ = [...pageSelf.qsbDetails[enName]]
        } else {
          value_ = setValue(pageSelf.qsbDetails[enName], value)
        }
      }
      if(enName=='protocolType'){
        value_ = {1:'渠道总模式',2:'非渠道总模式',3:'混合模式'}[pageSelf.qsbDetails[enName]]||'--'
      }
      item.value = getTypeData(enName, value_)
    })
  }
  setData(tempObj.defaultForm)
  setData(tempObj.otherForm)

  const {qsbDetails} = pageSelf

  if(!pageSelf.$IS.isNullOrUnDef(qsbDetails.businessAccountResp) && !pageSelf.$IS.isNullOrUnDef(qsbDetails.businessAccountResp.bankName)){
    pageSelf.caiConfig.value.bankName = qsbDetails.businessAccountResp.bankName
    pageSelf.caiConfig.value.accNo = qsbDetails.businessAccountResp.bankAccountNo
  }
  const tenpObj  = {entTaxPic:{}, entHirePic:{}}
  if(pageSelf.$IS.isArray(qsbDetails.entTaxPic.entTaxPicList)&& !pageSelf.$IS.isEmpty(qsbDetails.entTaxPic.entTaxPicList)){
    tenpObj['entTaxPic'] = {url:'',name:''}
    tenpObj.entTaxPic.name = qsbDetails.entTaxPic.entTaxPicList[0].fileName
    tenpObj.entTaxPic.url =qsbDetails.entTaxPic.entTaxPicList[0].fileUrl
  }
  if(pageSelf.$IS.isArray(qsbDetails.entHirePic.entHirePicList)&& !pageSelf.$IS.isEmpty(qsbDetails.entHirePic.entHirePicList)){
    tenpObj['entHirePic'] = {url:'',name:''}
    tenpObj.entHirePic.name = qsbDetails.entHirePic.entHirePicList[0].fileName
    tenpObj.entHirePic.url =qsbDetails.entHirePic.entHirePicList[0].fileUrl
  }
  pageSelf.qoriConfig &&  (pageSelf.qoriConfig.defaultList =tenpObj)
}


/**
 * 注册资金校验  单位：万元   保留小数点后6为  大于0
 * @param {*} pageSelf
 * @param {*} rule
 * @param {*} value
 * @param {*} callback
 */
const handleRegMoneyCheck = (pageSelf, rule, value, callback) => {
  // 12位整数 11  小数点后6位  undefined
  // console.log('注册资金校验 ====>',value);
  const ratioSize = (a, b) => {
    let res = true
    if (a >= b) {
      res = false
    }
    return res
  }
  // var reg=/^0\.([1-9]|\d[1-9])$|^[1-9]\d{0,11}\.\d{0,6}$|^[1-9]\d{0,11}$/
  var reg = /^\d+(?=\.{0,1}\d+$|$)/
  if (value[0] != undefined && !reg.test(value[0]) || value[1] != undefined && !reg.test(value[1])) {
    callback(new Error("请输入大于0的数字"))
  } else {
    if (value[0] == undefined && value[1] !== undefined) {
      callback(new Error("请在左侧框中输入数字"))
    } else if (value[0] !== undefined && value[1] == undefined) {
      callback(new Error("请在右侧框中输入数字"))
    } else {
      if (value[0] !== undefined && value[1] !== undefined && !ratioSize(value[0], value[1])) {
        callback(new Error("左侧框中的值必须大于右侧的"))
      } else {
        callback()
      }
    }
  }
}

/**
 *  企业状态对应的动作
 * @param {*} pageSelf
 * @param  {...any} args
 */
const qystatus2Action = (pageSelf, status_, record, index) => {
  const goto = (pageSelf, id, type = 0) => {
    const tempUrlList = {
      0: '/enterprise/enterpriseList/enterpriseDetails',
      1: '/enterprise/enterpriseList/enterpriseDetails1',
      2: '/invoice/applyInvoice',
    }
    pageSelf.$router.push({
      path: tempUrlList[type],
      query: {
        bizId: id
      }
    });
  }
  const tempActionList = {
    10: (pageSelf, record, index) => { goto(pageSelf, record.id) },
    11: (pageSelf, record, index) => { goto(pageSelf, record.id) },
    12: (pageSelf, record, index) => { goto(pageSelf, record.id) },
    20: (pageSelf, record, index) => { goto(pageSelf, record.id) },
    40: (pageSelf, record, index) => { goto(pageSelf, record.id) },
    60: (pageSelf, record, index) => { goto(pageSelf, record.id) },
    70: (pageSelf, record, index) => { goto(pageSelf, record.id) },
    80: (pageSelf, record, index) => { goto(pageSelf, record.id) },
    90: (pageSelf, record, index) => { goto(pageSelf, record.id) },
    110: (pageSelf, record, index) => { goto(pageSelf, record.id) },
    111: (pageSelf, record, index) => { goto(pageSelf, record.id) },
    112: (pageSelf, record, index) => { goto(pageSelf, record.id) },
    130: (pageSelf, record, index) => { goto(pageSelf, record.id) },
    131: (pageSelf, record, index) => { goto(pageSelf, record.id) },
    140: (pageSelf, record, index) => { goto(pageSelf, record.id, 2) },
    150: (pageSelf, record, index) => { goto(pageSelf, record.id, 1) },
    160: (pageSelf, record, index) => { goto(pageSelf, record.id, 1) },
    170: (pageSelf, record, index) => { goto(pageSelf, record.id, 1) },
  }
  tempActionList[status_](pageSelf, record, index)
}

/**
 * 签署委托书
 * @param {*} pageSelf
 * @param  {...any} arg
 */
const SigningPowerAttorney = (pageSelf, ...arg) => {
  const param = []
  pageSelf.selectedRows.forEach(item => {
    param.push({
      "certNo": item.cardNumber,
      "entId": item.id,
      "entLegalName": item.legalName
    })
  })
  getDataForDB('web端生成委托书', param).then(res => {
    const {success,result,message} =res
    if(success){
      pageSelf.winConfig.pdfUrl=result.contractUrl
      pageSelf.winConfig1.form.phone=result.legalPhone
      pageSelf.winConfig.dataList=result
      pageSelf.$nextTick(() => {
        PDFObject.embed(this.winConfig.pdfUrl, "#pdfBox");
      })
      pageSelf.winConfig.visible = true

    } else {
      pageSelf.$message.warning(message||'获取委托书信息失败')
    }
  })
}


const pageEvent = {
  getDataForTableList,
  handleRegMoneyCheck,
  getDataForEnterpriseDetails,
  qystatus2Action,
  ServicesInProgressData,
  SigningPowerAttorney,
  getLegalInfo,
  getTaxModeType,
  getDataForfpglTableList,
  getQueryEntSvConf,
  queryEntInvcAmount,
  setEntInvcAmount,
  delEntInfo
}

export default (type, pageSelf, ...args) => {
  return pageEvent[type](pageSelf, ...args)
}
